﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ReadAndWrite;

namespace ReadAndWriteTest
{
    /// <summary>
    /// Description résumée pour TestXML
    /// </summary>
    [TestClass]
    public class TestCSV
    {
        private List<ISerializableCSV> listPersonne;
        private ReadAndWriteCSV rw;


        [TestInitialize]
        public void Initialize()
        {
            rw = new ReadAndWriteCSV(@"C:\Users\legouellecs\Desktop\personne.csv", ";");
            listPersonne = new List<ISerializableCSV>();
            listPersonne.Add(new PersonneTest("LE GOUELLEC", "SYLVAIN", 20, "29 impasse des riaumes"));
            listPersonne.Add(new PersonneTest("LE GOUELLEC", "VALENTIN", 19, "29 impasse des riaumes"));
            listPersonne.Add(new PersonneTest("LE GOUELLEC", "CLAIRE", 17, "29 impasse des riaumes"));
        }

        [TestMethod]
        public void TestMethodWriteCSV()
        {
            Assert.AreEqual(true, rw.WriteCSV("", listPersonne));
        }

        [TestMethod]
        public void TestMethodReadCSV()
        {
            listPersonne.Clear();
            listPersonne = rw.ReadCSV(typeof(PersonneTest));
            Assert.AreEqual(3, listPersonne.Count);
        }

    }
}
